<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<script language="javascript" src="../myClass/MyClass.js"></script>
<script language="javascript" src="Voltimetro.js"></script>
</head>

<body>

<div id="tablero_content" style="width:100%; text-align:center; overflow:hidden"> 
   <table align="center" width="600" cellspacing="0" cellpadding="0"="" border="1px">
      <tr>
      	<td width="160"><input name="" value="Desactivar Voltimetro A" type="button" onclick="voltimetro.moveToVoltA(null)" /></td>
        <td width="120" height="100" bgcolor="#1F1A17" id="posVoltimetro" align="center"></td>
        <td width="160"><input name="" value="Desactivar Voltimetro B" type="button" onclick="voltimetro.moveToVoltB(null)" /></td>
      </tr>	
      <tr>
      	<td id="voltA">Voltaje A: 0 V.</td>
        <td><input name="" value="cambiar" type="button" onclick="change();" /></td>
        <td id='voltB'>Voltaje B: 0 V.</td>
      </tr>	
   </table>
</div>

<script type="text/javascript">
	var voltimetro = new Voltimetro('images/');
	voltimetro.putDisplayIn('posVoltimetro');
	
	function aleatorio(inferior,superior){ 
   		numPosibilidades = superior - inferior; 
    	aleat = Math.random() * numPosibilidades; 
	    aleat = Math.floor(aleat); 
    	return parseInt(inferior) + aleat; 
	} 
	
	function change(){
		var voltA = aleatorio(0,31);
		var voltB = aleatorio(0,31); 
		document.getElementById('voltA').innerHTML = 'Voltaje A: '+voltA+' V.';
		document.getElementById('voltB').innerHTML = 'Voltaje B: '+voltB+' V.';
		voltimetro.moveToVoltA(voltA);
		voltimetro.moveToVoltB(voltB);
	}
			
</script>

</body>
</html>
